package week13.queue.memory;

import week13.queue.api.Storage;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class MemoryStorage implements Storage {


    private List<Object> dataList = new CopyOnWriteArrayList<>();

    public MemoryStorage() {
        
    }

    @Override
    public void put(Object data) {
        dataList.add(data);
    }

    @Override
    public Object get(long offset) {
        if(offset > dataList.size()){
            return null;
        }
        return dataList.get((int) offset);
    }


}
